package com.yboot.starter.common.core.exception;

public enum ErrorCodeEnum implements ErrorCodeSpecification {
    OK("200", "操作成功"),
    CLIENT_ERROR("400", "客户端请求错误"),
    UNAUTHORIZED("401", "身份认证失败"),
    FORBIDDEN("403", "没有相关权限"),
    NOT_FOUND("404", "资源未找到"),
    COMMON_ERROR("500", "{0}"),
    SERVER_ERROR("500", "服务端异常"),
    BUSINESS_ERROR("500", "业务异常"),
    APPLICATION_IS_EMPTY("10101", "应用信息不能为空"),
    PLATFORM_IS_EMPTY("10102", "平台信息不能为空"),
    USERNAME_IS_EMPTY("10103", "用户名不能为空"),
    USERNAME_OR_PASSWORD_IS_ERROR("10104", "用户名或密码错误"),
    PASSWORD_ERROR_LIMIT("10105", "已登录失败%d次，累计失败%d次后锁定%d分钟"),
    ACCOUNT_IS_DISABLE("10106", "账号已经被停用"),
    ACCOUNT_IS_LOCKED("10107", "账号已经被锁定"),
    ACCOUNT_IS_EXPIRED("10108", "账号已经过期"),
    PASSWORD_IS_EXPIRED("10109", "密码已经过期"),
    TOKEN_AUTH_ERROR("10110", "认证失败"),
    TOKEN_IS_EMPTY("10111", "未能读取到有效 Token"),
    TOKEN_IS_INVALID("10112", "Token 无效"),
    TOKEN_IS_EXPIRED("10113", "Token已过期"),
    TOKEN_IS_OFFLINE("10114", "Token已被顶下线"),
    TOKEN_IS_KICKED("10115", "Token已被踢下线"),
    TOKEN_IS_FROZEN("10116", "Token已被冻结"),
    TOKEN_IS_NOT_PREFIX("10117", "前端未按照指定的前缀提交 token"),
    PLATFORM_IS_DIFFERENT("10118", "Token 与应用/平台信息不匹配"),
    TOKEN_ACCOUNT_NOT_FOUNT("10119", "此 Token 找不到有效账户信息"),
    TENANT_ID_IS_EMPTY("10120", "租户ID不能为空"),
    METHOD_ARGUMENT_NOT_VALID("10201", "请求参数不合法"),
    VALIDATION_CODE_ERROR("10202", "数据校验代码开发错误，请联系开发同学"),
    HTTP_METHOD_NOT_SUPPORTED("10203", "不支持的请求方法"),
    MISSING_REQUEST_VALUE("10204", "缺少请求参数"),
    HTTP_MESSAGE_NOT_READABLE("10205", "请求参数读取错误"),
    HTTP_MESSAGE_NOT_WRITABLE("10206", "响应参数写入错误"),
    METHOD_ARGUMENT_TYPE_MISMATCH("10207", "请求参数类型不匹配"),
    OBJECT_NOT_EXIST("10208", "对象{0}不存在"),
    NO_SUCH_MESSAGE("10221", "找不到对应的消息"),
    DATABASE_COMMON_ERROR("20100", "数据库异常"),
    DATABASE_UNIQUE_KEY_VIOLATED("20101", "{0}已存在");

    private final String code;
    private final String message;

    private ErrorCodeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }
}